作者:mobiledu2502855037 | 来源:互联网 | 2023-09-12 14:22
This is the 3rd scenario found by this paper that commonly causes critical failures: "Error handlers that catch an abstract exception type (e.g. Exception or Throwable in Java) and then take drastic action such as aborting the system."
Now, I don't know if this directly translates. And I think the result_unwrap_used and option_unwrap_used lints catch the most common ways of doing this in Rust! But there's another way, and I don't know if this is common enough to justify a lint:
1 2 3 4 5 6 7 8 9
| rust
match something {
Ok(stuff) => {
// happy path stuff
},
Err(_) => {
panic!("stop the world");
},
} |
the key parts being the matching of any type of error, and the drastic action in the
arm.
Again, please do close this if this doesn't seem like a worthwhile idea!! <3
该提问来源于开源项目:rust-lang/rust-clippy
is there a preferring when to use which?
tends to be simpler and more stable so usually if it's possible, go for it.
however is more powerful, names, types, functions, modules, constants, etc. have all be resolved and we can use that information.
is there a way I can convert between the structures in two modules?
No. Note that this would rarely be useful as almost all information in
is also available in
.